<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>19. 区间匹配</title>
    </head>
    <body>
        <input type="text" name="username" />
        <script type="text/javascript">
           /**
           [0-9] [a-zA-Z] 区间匹配  - 代表区间的意思，而且只能升序
           [a-z] 字母区间
           + 贪婪匹配
           */ 
            
           // let hd='2010';
           // console.log(hd.match(/\d+/g)) //["2010"]
           // console.log(hd.match(/[0-9]+/g)) //["2010"]
           
           
           // let hd="houdunren"
           // console.log(hd.match(/[a-z]/g))  //["h", "o", "u", "d", "u", "n", "r", "e", "n"]
           // console.log(hd.match(/[a-z]+/g))  //["houdunren"]
        
            let input =document.querySelector(`[name="username"]`);
            input.addEventListener('keyup',function(){
               let inv= this.value.match(/^[a-z]\w{3,6}$/i);
               console.log(inv)
            })
        </script>
    </body>
</html>
